package com.abc.cloud.common.utils;

import com.abc.cloud.entity.UserEntity;

import java.util.List;

/**
 * 用于存储用户线程
 */

public class UserHolder {

    private static final ThreadLocal<UserEntity> tl = new ThreadLocal<>();

    private static final ThreadLocal<List<String>> t2 = new ThreadLocal<>();

    public static void saveUser(UserEntity user){
        tl.set(user);
    }

    public static UserEntity getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }

    public static void saveAuthorities(List<String> authorities){
        t2.set(authorities);
    }

    public static List<String> getAuthorities(){
        return t2.get();
    }

    public static void removeAuthorities(){
        t2.remove();
    }


}
